// 统一管理项目接口api
import requests from "./request";

// 如下loginTest、getCaptchaTest是测试用的api
export const loginTest = (data) => requests({ url: '/login', method: 'post', params: data });
export const getCaptchaTest = () => requests({ url: '/getCaptcha', method: 'get' });
// 后端正式请求api==================================================================================
//根据类型获取贴文列表
export const getPostList = (type) => requests({ url: '/getPostByType/' + type, method: "get" })
//获取热帖
export const getTopPostList = () => requests({ url: '/getTopPostList', method: "get" })
//获取个人信息
export const getPersonInfo = () => requests({ url: '/getUser', method: "get" })
//更新个人信息（密码除外）
export const updateUser = (userInfo) => requests({ url: '/updateUser', method: 'put', params: userInfo });
//更新密码
export const updatePassword = (data) => requests({ url: '/updatePassword', method: 'put', params: data });
//获取个人贴文
export const getPostByUpId = (upId) => requests({ url: '/listPostByUpId/' + upId, method: 'get' });
//根据postId获取贴文详情 /bingo/listPostByPostId/{postId}
export const getPostByPostId = (postId) => requests({ url: `/listPostByPostId/${postId}`, method: 'get' });
// 用户发布贴文，post请求，query参数params:{content,type,upId}
export const publishPost = (params) => requests({url:'/publishPost',params,method:'post'});
// 用户修改贴文，put请求，params参数，{upId,postId,type,content}
export const editPostById = (params) => requests({url:'/editPostById',params,method:'put'});
// 获取所有贴文 get请求
export const getAllPosts = () => requests({url:'/listPost',method:'get'});
// 根据贴文id删除贴文 /deletePostById/{postId} delete请求
export const deletePostById = (postId) => requests({url:`/deletePostById/${postId}`,method:'delete'});
// 用户点赞/点踩贴文 bingo/praisePost delete请求 params参数{postId,userId,type}\
export const praisePost = (params) => requests({url:'/praisePost',params,method:'get'});
// 根据用户Id获取用户所有点赞过的贴文Id /bingo/postPraiseList params参数{userId} get请求
export const postPraiseList = (params) => requests({url:'/postPraiseList',params,method:'get'});
// 根据用户id获取用户所有视频 /bingo/selectVideoByUpId/{upId} GET请求
export const selectVideoByUpId = (upId) => requests({url:`/selectVideoByUpId/${upId}`,method:'get'});
// 获取用户浏览记录/bingo/getHistory get请求
export const getHistory = () => requests({url:'/getHistory',method:'get'});


